#define _CRT_SECURE_NO_WARNINGS 1
#include"slist.h"


void test1()
{
	SListNode* plist = NULL;
	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SListPushBack(&plist, 5);
	SListPushBack(&plist, 6);
	SListPrint(plist);
}

void test2()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListPrint(plist);
	SListPopBack(&plist);
	SListPrint(plist);
	SListPopBack(&plist);
	SListPrint(plist);
	SListPopBack(&plist);
	SListPrint(plist);
	SListPopBack(&plist);
	SListPrint(plist);
	SListPopBack(&plist);
	SListPrint(plist);
	/*SListPopBack(&plist);
	SListPrint(plist);*/
}

void test3()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListPopFront(&plist);
	SListPrint(plist);
	SListPopFront(&plist);
	SListPrint(plist);
	SListPopFront(&plist);
	SListPrint(plist);
	SListPopFront(&plist);
	SListPrint(plist);
	SListPopFront(&plist);
	SListPrint(plist);
	/*SListPopFront(&plist);
	SListPrint(plist);*/
}

void test4()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListNode* pos = SListFind(&plist, 3);
	printf("%d", pos->val);
}

void test5()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListNode* pos = SListFind(&plist, 3);
	SListInsertAfter(pos, 30);
	SListPrint(plist);
}

void test6()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListNode* pos = SListFind(&plist, 3);
	SListEraseAfter(pos);
	SListPrint(plist);
}

void test7()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListNode* pos = SListFind(&plist, 3);
	SListInsert(&plist, pos, 30);
	SListPrint(plist);
	pos = SListFind(&plist, 5);
	SListInsert(&plist, pos, 50);
	SListPrint(plist);
}
void test8()
{
	SListNode* plist = NULL;
	SListPushFront(&plist, 1);
	SListPushFront(&plist, 2);
	SListPushFront(&plist, 3);
	SListPushFront(&plist, 4);
	SListPushFront(&plist, 5);
	SListNode* pos = SListFind(&plist, 3);
	SListInsert(&plist, pos, 30);
	SListPrint(plist);
	pos = SListFind(&plist, 5);
	SListErase(&plist, pos);
	SListPrint(plist);
	SListDestroy(&plist);
}

int main()
{
	/*test();*/
	/*test3();*/
	test8();
	return 0;
}